package com.baijiaxing.weixin.family.service.impl;

import com.baijiaxing.weixin.family.client.model.TsDTO;
import com.baijiaxing.weixin.family.client.param.TsParam;
import com.baijiaxing.weixin.family.mapper.TsMapper;
import com.baijiaxing.weixin.family.model.TsDO;
import com.baijiaxing.weixin.family.client.service.TsService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Copyright  BeijingDMCC Co. Ltd.
 * All right reserved
 * 创建日期 16/12/18
 *
 * @Title
 * @Description：TsServiceImpl
 * @author：yinhongke
 * @email：hongke.yin@datamining.cn
 * @mender:
 * @version：1.0
 * @since：
 * @Remark：
 */
@Service
public class TsServiceImpl implements TsService{
    @Autowired
    private TsMapper tsDao;
    public TsDTO insert(TsParam ts){


        TsDO tsDO  = new TsDO();
        BeanUtils.copyProperties(ts,tsDO);
        tsDao.insert(tsDO);
        return selectById(tsDO.getId()+"");
    }

    public TsDTO selectById(String id) {
        TsDTO tsDTO = new TsDTO();
        BeanUtils.copyProperties(tsDao.selectById(id),tsDTO);
        return tsDTO;
    }

}
